let path = require('path')
let htmlWebpackPlugin = require('html-webpack-plugin')
function resolve(o) {
    return path.resolve(__dirname, o)
}
module.exports = {
    entry: {
        main: resolve('src/scripts/main.js'),
        a: resolve('src/scripts/a.js'),
        b: resolve('src/scripts/b.js'),
        c: resolve('src/scripts/c.js')
    }, // 指定入口文件
    output: {
        path: resolve('dist'),
        // filename: '[name]-[hash].js'
        filename: "js/[name]-[chunkhash].js",
        // publicPath: ''
    },
    plugins: [
        new htmlWebpackPlugin({
            // filename: "index-[hash].html",
            // filename: 'index-[chunkhash].html',
            filename: "a.html", // 生成 dist/a.html
            template: 'index.html', // 指定根目录下的 index.html
            inject: 'body',
            chunks: ['main', 'a'],
            excludeChunks: ['b'],
            title: 'html webpack plugin aaaaa'
        }),
        new htmlWebpackPlugin({
            // filename: "index-[hash].html",
            // filename: 'index-[chunkhash].html',
            filename: "b.html", // 生成 dist/b.html
            template: 'index.html', // 指定根目录下的 index.html
            inject: 'body',
            chunks: ['b'],
            excludeChunks: ['c','a'],
            title: 'html webpack plugin bbbbb'
        }),
        new htmlWebpackPlugin({
            // filename: "index-[hash].html",
            // filename: 'index-[chunkhash].html',
            filename: "c.html", // 生成 dist/c.html
            template: 'index.html', // 指定根目录下的 index.html
            inject: 'body',
            chunks: ['c'],
            excludeChunks: ['a', 'b'],
            title: 'html webpack plugin cccccc'
        }),
    ]
}